import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../../viewmodel/MainPageViewModel.dart';

class ChartPage extends StatefulWidget {
  const ChartPage({super.key});

  @override
  State<ChartPage> createState() => _ChartState();
}

class _ChartState extends State<ChartPage> {
  final _mainPageViewModel = MainPageViewModel();

  void _gg() {
    // var firstLevelCategory = FirstLevelCategory(name: "xcxcx");
    // DatabaseHelper().insert(FirstLevelCategory(name: "xcxcx"));
    //
    setState(() {});
  }

  @override
  void initState() {
    super.initState();
    name();
  }

  Future<void> name() async {
    await _mainPageViewModel.getALLOneCategory();
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Container(
                color: Colors.blue,
                height: 50,
                width: 100,
                child: Center(
                  child: Text('Left Aligned'),
                ),
              ),
            ],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              Container(
                color: Colors.green,
                height: 50,
                width: 100,
                child: Center(
                  child: Text('Right Aligned'),
                ),
              ),
            ],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Container(
                color: Colors.orange,
                height: 50,
                width: 100,
                child: Center(
                  child: Text('Centered'),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
